import { lazy } from 'react'
import { createBrowserRouter } from 'react-router-dom'
import App from '../App'

const Home = lazy(() => import('../pages/home/Index'))

const Index = lazy(() => import('../pages/index/Index'))
const Class = lazy(() => import('../pages/class/Index'))

export const homeRouter = [
    {
        path: '/home/index',
        element: <Index />,
        title: '首页'
    },
    {
        path: '/home/class',
        element: <Class />,
        title: '分类'
    },
]

const router = createBrowserRouter([
    {
        path: '/',
        element: <App />,
        children: [
             {
                index: true,
                element: <Home />,
            },
            {
                path: '/home',
                element: <Home />,
                children: homeRouter
            }

        ]
    }
])

export default router